<!-- 实现博客正文页 -->


<!-- 引入导航栏 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/blog_content.css">
</head>
<body>
    <!-- 导航栏 -->
    <!-- 导航栏里面包含logo，标题，和一些按钮也就是跳转链接-->
    <!-- 为了实现左右排列，在logo和按钮之间加一个spacer作为占位器 -->
    <div class="nav">
        
        <!-- 放入图片D:/image/dog.png作为logo -->
        <img src="image/cat.png" alt="">
        <!-- span在行内定义一块区域 -->
        <span class="title">我的博客系统</span>
        <!-- 用来占据中间位置 -->
        <span class="spacer"></span>
        <a href="blog_list.html">主页</a>
        <a href="blog_edit.html">写博客</a>
        <a href="login.html">注销</a>
    </div>

    <!-- 版心 -->
    <div class="container">
        <!-- 左侧个人信息 -->
        <div class="container-left"> 
            <!-- 将个人信息放到.card div中 -->
            <div class="card">
                <img src="image/cat.png" class="avtar" alt="">
                <h3>xun</h3>
                <a href="https://blog.csdn.net/crazy_tan/">github 地址</a>
                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>
                <div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>
            </div>
        </div>

        <!-- 右侧内容详情 -->
        <div class="container-right">
            
            <!-- 博客内容整体放到blog_content中 -->
            <div class="blog_content">
                <!-- 博客标题 -->
                <div class="title"></div>
                <!-- 博客时间 -->
                <div class="date"></div>
                <!-- 博客正文 -->
                <div class="detail" id="blog_content">

                </div>
            </div>
        </div>
    </div>
    <script src="js/jquery.min.js"></script>
    <script src="editor.md-master/lib/marked.min.js"></script>
    <script src="editor.md-master/lib/prettify.min.js"></script>
    <script src="editor.md-master/editormd.js"></script>
    <script src="js/common.js"></script>
    <script>
        //获取博客详细信息
        $.ajax({
            type:"get",
            // 拿到的是？blogId=2
            url:"blog" + location.search,
            success:function(blog){
                console.log(blog);
                document.querySelector(".blog_content .title").innerHTML = blog.title;
                document.querySelector(".blog_content .date").innerHTML = blog.date;
                // document.querySelector(".blog_content .detail").innerHTML = blog.detail;
                //通过markdown 来进行页面的渲染
                editormd.markdownToHTML("blog_content", {
                        markdown: blog.blog_content
                });
            }
        });
        //获取用户登录信息
        getUserInfo("detail");
    </script>
</body>
</html>